<?php
	class FooterWidget extends CWidget
	{
		public function run()
		{
			$this->getfooter();
		}
		public function getfooter()
		{
			try{
				$criteria = new CDbCriteria;
				$criteria->condition = 'disabled=:status AND parent_id is null';
				$criteria->params = array(':status' => 1);
				$criteria->order = 'priority ASC';
				$menu = Menu::model()->findAll($criteria);
				// /*fb like*/
				// $fblike = 0;
				// $url = str_replace('https://www.facebook.com','https://graph.facebook.com', Yii::app()->params['facebook']);
	   //          if(Yii::app()->params['facebook']){
		  //           $fblike = $this->file_get_contents_curl($url);
		  //       }
				$this->render('footer', compact(array('menu')));
			}catch(Exeption $e){
				echo $e;
			}
		}
		public function file_get_contents_curl($url){
			if(file_get_contents($url)){
			    $json = file_get_contents($url, true);
			    $decode = json_decode($json, true);
		        return $decode['likes'];
		    }
		}
	}
?>